<!DOCTYPE html>
<html lang="zh">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta http-equiv="X-UA-Compatible" content="ie=edge">
		<title>机构端</title>
        <script src="/Public/static/jquery-2.0.3.min.js"></script>
        <script src="/Public/static/layer/layer.js"></script>
        <link rel="stylesheet" href="__PUBLIC__/Home/css/reset.css">
        <link rel="stylesheet" href="__PUBLIC__/Home/css/style.css">
	</head>

	<body class="agency_box contentBox pos_rel dpflxr">
		<include file="head" />

		<!-- 2.垂直导航 -->
		<div class="navColumn">
			<a href="{:U('Mechanism/floor_index')}" <if condition="$cur eq 楼盘管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='1'>
				<div class="lineColumn pos_abs"></div>
				<label for="">楼盘管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/house_type')}"  <if condition="$cur eq 户型管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if> data-type='2'>
				<div class="lineColumn pos_abs"></div>
				<label for="">户型管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/build_manage')}" <if condition="$cur eq 楼栋管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if>  data-type='3'>
				<div class="lineColumn pos_abs"></div>
				<label for="">楼栋管理</label>
				<div class="rightArrow">
				</div>
			</a>
			<a href="{:U('Mechanism/souse_res')}" <if condition="$cur eq 房源管理">class="navColumnItem actived dpflxr pos_rel"<else />class="navColumnItem  dpflxr pos_rel"</if>  data-type='4'>
				<div class="lineColumn pos_abs"></div>
				<label for="">房源管理</label>
				<div class="rightArrow">
				</div>
			</a>
			
		</div>



		<!-- 二 3.1 楼盘管理  -->
		<div class="contentArea tabPage actived">
			<!-- 3.1.2 新增楼盘 -->
			<div class="addProject">
				<div class="caTitleBox dpflxr">
					<label for="" class="caTitle">新增户型</label>
				</div>
				
				
				<!-- 3.1.2.1 基本信息-->
				<form action="" method="POST">
				<div class="switchPage tabPageF actived card dpflxr">
					
					<div class="contentItem  dpflxr ">
						<label for="" class="title">户型名称：</label>
						<div class="pos_rel">
							<input type="text" class="inputBox" name="name" value="{$info.name}" placeholder="请输入户型名称" style="padding-right: 56px;"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;"/>
							<label class="pos_abs unit">0/10</label>
						</div>
						
					</div>
					<div class="contentItem  dpflxr">
						<label for="" class="title">所属楼盘：</label>
						
						<select name="floor_id" id="" class="selectBox">
							<volist name="floor_list" id="item">
								<option value="{$item.id}" <if condition="$item['id'] eq $info['floor_id']">selected</if>>{$item.name}</option>
							</volist>
						</select>
					</div>
					
					<div class="contentItem  dpflxr">
						<label for="" class="title">销售状态：</label>
						
						<select name="status" id="" class="selectBox">
							<option value="1" <if condition="$info['status'] eq 1">selected</if>>待售</option>
							<option value="2" <if condition="$info['status'] eq 2">selected</if>>在售</option>
							<option value="3" <if condition="$info['status'] eq 3">selected</if>>售罄</option>
						</select>
					</div>
					<div class="contentItem  dpflxr">
						<label for="" class="title">户型配置：</label>
						<input type="text" class="inputBox" name="house_config" value="{$info['house_config']}" placeholder="请输入户型配置"
							placeholder-style="font-size:16px;line-height:48px;color:#bfa;" />
					</div>
					<div class="contentItem  dpflxr ">
						<label for="" class="title">户型面积：</label>
						<div class="pos_rel">
							<input type="text" class="inputBox" name="house_area" value="{$info['house_area']}" placeholder="请输入户型面积" style="padding-right: 56px;"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;"/>
							<label class="pos_abs unit">m²</label>
						</div>
						
					</div>
					<div class="contentItem  dpflxr ">
						<label for="" class="title">参考价：</label>
						<div class="pos_rel">
							<input type="text" class="inputBox" name="price" value="{$info['price']}" placeholder="请输入参考价" style="padding-right: 56px;"
								placeholder-style="font-size:16px;line-height:48px;color:#bfa;"/>
							<label class="pos_abs unit">万元/套</label>
						</div>
						
					</div>
					<div class="contentItem upload2 dpflxrw">
						<label for="" class="title">封面图：</label>
						<div class="image pos_rel im" id="cc">
							<if condition="$info['img'] neq ''"><img src="{$info.img}"></if>
							<div class="icon pos_abs">
								
							</div>
							<label for="" class="suggestion pos_abs">建议尺寸 280px*200px</label>
							
						</div>
					</div>

					
					<input type="hidden" name="id" value="{$info['id']}">
					<input type="hidden" name="house_img" value="{$info['house_img']}">
					<div class="ciBtnWrapper">
						<button type="submit" class="ciBtn">确认</button>
					</div>
					
				
				</div>
				</form>
				


			</div>

	</body>
</html>
<script type="text/javascript">
$("body").on('click','#cc',function(){
    var thisObj = $(this);
    var inputFile = document.createElement("input");
    inputFile.type = "file";
    inputFile.name = "file[]";
    inputFile.multiple = "multiple";
    inputFile.accept = "image/jpeg,image/jpg,image/png";
    inputFile.click();
    $(inputFile).change(function(){
        var files = inputFile.files;
        for(var i=0;i<files.length;i++){
            uploadImg(files[i],thisObj);
        }
    });
});
function uploadImg(file,thisObj){
    var formData = new FormData();
    formData.append('image', file);
    $.ajax({
        url: "{:U('Mechanism/uploadImg')}",
        type: "post",
        data: formData,
        dataType:"json",
        contentType: false,
        processData: false,
        mimeType: "multipart/form-data",
        success: function (data) {
            if(data.code == 0){
            　　console.log(data.info.imgid);
                var imgid=data.info.imgid;
            	$("input[name='house_img']").val(imgid);
            	var img=data.info.imgurl;
            	$('.im').html('<img src="'+img+'"/>');

　　　　　　　}
        },
    });
}
// $("body").on('click','.ciBtn',function(){

// 	var img=$("input[name='img']").val();
// 	var name=$("input[name='name']").val();
// 	var introduction=$("textarea[name='introduction']").val();
// 	// alert(img);
// 	$.ajax({
// 		url: "{:U('Mechanism/save_xx')}",
//         type: "post",
//         data: {img:img,name:name,introduction:introduction},
//         dataType:"json",
//         success: function (data) {
//             if(data.result == 1){
//             　　alert('成功');
//     			var url = "{:U('Mechanism/index')}";
//                 location.href=url;

// 　　　　　　　}else{
// 				alert('失败');
// 				var url = "{:U('Mechanism/index')}";
// 	            location.href=url;

// 			}
//         },
// 	})
// })
</script>